<div class="leftnews">
    <div class="bgtitle_news">
        <div class="title_news1_r"></div>
        <div class="title_news1">
            <h2><a href="javascript:void(0);">[Danh mục tin]</a></h2>
        </div>

    </div>
    <div class="leftnews_line">
        <ul>
            <?php
            $NewsCat = listAllNewsCategory($parent_id = 0);
            $totalNews = count($NewsCat);
            if($param[0]==$CONFIG_OPTION["detail"]) {//if action = detail
                $rsNewsDetail = getNewsDetail($param[1]);
                for($i=0;$i<count($NewsCat);$i++) {
                    if($NewsCat[$i]['cat_id']==$rsNewsDetail['cat_id']) {
                        if($i==($totalNews-1)) {
                            echo "<li class='last_current'><a href='".get_link("news","cat",$NewsCat[$i]['cat_link'])."' title='".htmlentities_utf8($NewsCat[$i]['cat_title'])."'>".$NewsCat[$i]['cat_title']."</a></li>";
                        }else {
                            echo "<li><a class='current_cat' href='".get_link("news","cat",$NewsCat[$i]['cat_link'])."' title='".htmlentities_utf8($NewsCat[$i]['cat_title'])."'>".$NewsCat[$i]['cat_title']."</a></li>";
                        }
                    }else {
                        if($i==($totalNews-1)) {
                            echo "<li class='last'><a href='".get_link("news","cat",$NewsCat[$i]['cat_link'])."' title='".htmlentities_utf8($NewsCat[$i]['cat_title'])."'>".$NewsCat[$i]['cat_title']."</a></li>";
                        }else {
                            echo "<li><a href='".get_link("news","cat",$NewsCat[$i]['cat_link'])."' title='".htmlentities_utf8($NewsCat[$i]['cat_title'])."'>".$NewsCat[$i]['cat_title']."</a></li>";
                        }
                    }
                }
            }else {
                for($i=0;$i<count($NewsCat);$i++) {
                    if($NewsCat[$i]['cat_link']==$param[1]) {
                        if($i==($totalNews-1)) {
                            echo "<li class='last_current'><a href='".get_link("news","cat",$NewsCat[$i]['cat_link'])."' title='".htmlentities_utf8($NewsCat[$i]['cat_title'])."'>".$NewsCat[$i]['cat_title']."</a></li>";
                        }else {
                            echo "<li><a class='current_cat' href='".get_link("news","cat",$NewsCat[$i]['cat_link'])."' title='".htmlentities_utf8($NewsCat[$i]['cat_title'])."'>".$NewsCat[$i]['cat_title']."</a></li>";
                        }
                    }else {
                        if($i==($totalNews-1)) {
                            echo "<li class='last'><a href='".get_link("news","cat",$NewsCat[$i]['cat_link'])."' title='".htmlentities_utf8($NewsCat[$i]['cat_title'])."'>".$NewsCat[$i]['cat_title']."</a></li>";
                        }else {
                            echo "<li><a href='".get_link("news","cat",$NewsCat[$i]['cat_link'])."' title='".htmlentities_utf8($NewsCat[$i]['cat_title'])."'>".$NewsCat[$i]['cat_title']."</a></li>";
                        }
                    }
                }
            }
            ?>
        </ul>
    </div>

    <div class="bgtitle_news">
        <div class="title_news1_r"></div>
        <div class="title_news1">
            <h2><a href="javascript:void(0);">[Tin quan tâm nhiều]</a></h2>
        </div>

    </div>
    <div class="left_news2" style="margin-bottom:5px;">
        <ul class="top_r_n">
            <?php
            $rsMostRead = getNewsMostRead();
            $i=0;
            while($rs=$db->fetch_array($rsMostRead)) {
                $i++;
                ?>
            <li>
                <a class="number" href="<?php echo get_link('news', 'detail', $rs['title_link'])?>"><?php echo $i;?>.</a><a href="<?php echo get_link('news', 'detail', $rs['title_link'])?>" class="other_n_l"><?php echo $rs['title'];?></a>
            </li>
            <?php
        }
        ?>
        </ul>
    </div>

  <?php
        $rsAdv = getAdvClient('news', 'left', 5);
        if($db->num_rows($rsAdv)){
    ?>
    <div class="bgtitle_news">
         <div class="title_news1_r"></div>
        <div class="title_news1">
            <h2><a href="javascript:void(0);">[Quảng cáo]</a></h2>
        </div>

    </div>
    <div class="left_news2" >
        <div class="left_project" >
            <?php
            while ($row = $db->fetch_array($rsAdv)) {
                ?>
            <div style="padding: 2px;">
                <a href="<?php echo $row['link'];?>"><img alt="" src="<?php echo $row['filename'];?>" width="180px;"/></a>
            </div>
            <?php }?>

        </div>
    </div>
    <?php }?>
   

</div>